/*
 * @Author: 噜噜雯雯 2199987619@qq.com
 * @Date: 2025-09-04 16:43:34
 * @LastEditors: 噜噜雯雯 2199987619@qq.com
 * @LastEditTime: 2025-09-16 10:26:51
 * @FilePath: \linePatrol\vue-element-plus-admin\src\api\securcheck\CompanyLedger.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import service from '@/axios/http'
import { TableIResponse } from '@/utils/Api'
import { MeterLedger } from './type'
export class SecurCheckMeterLedgerApi {
  //查询表具台账列表
  async GetMeterLedger(params: any): Promise<TableIResponse<MeterLedger[]>> {
    const result = (await service.get('/api/securcheck/tbMeterLedger/list', {
      params
    })) as unknown as any
    return result
  }

  //删除表具台账列表
  async DeletMeterLedger(uuids: string | undefined): Promise<boolean> {
    const result = (await service.delete(
      `/api/securcheck/tbMeterLedger/${uuids}`
    )) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //新增表具台账列表
  async AddMeterLedger(data: MeterLedger): Promise<boolean> {
    const result = (await service.post('/api/securcheck/tbMeterLedger', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //修改表具台账列表
  async EditMeterLedger(data: MeterLedger): Promise<boolean> {
    const result = (await service.put('/api/securcheck/tbMeterLedger', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //查询表具台账详情
  async GetMeterLedgerById(uuid: string | undefined): Promise<MeterLedger> {
    const result = (await service.get(`/api/securcheck/tbMeterLedger/${uuid}`)) as unknown as any
    const { code, data } = result
    if (code == 200) {
      return data
    } else {
      return {}
    }
  }
  //生成表具
  async CreateMeter(data: string): Promise<boolean> {
    const result = (await service.post('/api/securcheck/tbMeterLedger/userMeter', {
      meterType: data
    })) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
}
export default new SecurCheckMeterLedgerApi()
